#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, a, b, c, d, e, f;
    cin >> n >> a >> b >> c >> d >> e >> f;
    
    int A = ceil(1.0 * n / a) * b;
    int B = ceil(1.0 * n / c) * d;
    int C = ceil(1.0 * n / e) * f;
    
    cout << min(A, min(B, C));
    return 0;
}

